﻿using System;
using System.Xml;
using Notoric.Model.Internal;
using Notoric.Model.Packaging;

namespace Notoric.Model.Elements.CWNotation
{
    /// <summary>
    /// Represents a slur (legato).
    /// </summary>
    public class Slur : Arc
    {
        #region Constructors

        /// <summary>
        /// Initializes a new instance of the <see cref="Slur"/> class.
        /// </summary>
        /// <param name="packagePart">
        /// <para>
        /// Type: <see cref="XmlPackagePart"/>
        /// </para>
        /// <para>
        /// The package part that owns this connector.
        /// </para>
        /// </param>
        /// <param name="owner">
        /// <para>
        /// Type: <see cref="System"/>
        /// </para>
        /// <para>
        /// The system that directly owns this connector.
        /// </para>
        /// </param>
        /// <param name="presentedConnector">
        /// <para>
        /// Type: <see cref="LegatoElement"/>
        /// </para>
        /// <para>
        /// The presented connector.
        /// </para>
        /// </param>
        /// <exception cref="ArgumentNullException">
        /// Any of the arguments is <see langword="null"/>.
        /// </exception>
        /// <exception cref="ArgumentException">
        /// The <paramref name="owner"/> does not contain any of the symbols connected by the <paramref name="presentedConnector"/>.
        /// </exception>
        internal Slur(XmlPackagePart packagePart, System owner, LegatoElement presentedConnector)
            : base(packagePart, owner, presentedConnector)
        {
        }

        /// <summary>
        /// Initializes a new instance of the <see cref="Slur"/> class.
        /// </summary>
        /// <param name="packagePart">
        /// <para>
        /// Type: <see cref="XmlPackagePart"/>
        /// </para>
        /// <para>
        /// The package part that owns this connector.
        /// </para>
        /// </param>
        /// <param name="owner">
        /// <para>
        /// Type: <see cref="System"/>
        /// </para>
        /// <para>
        /// The system that directly owns this connector.
        /// </para>
        /// </param>
        /// <param name="element">
        /// <para>
        /// Type: <see cref="XmlElement"/>
        /// </para>
        /// <para>
        /// The XML element that holds the data of this connector.
        /// </para>
        /// </param>
        /// <exception cref="ArgumentNullException">
        /// Any of the arguments is <see langword="null"/>.
        /// </exception>
        internal Slur(XmlPackagePart packagePart, System owner, XmlElement element)
            : base(packagePart, owner, element)
        {
        }

        #endregion

        #region Arc Members

        /// <inheritdoc/>
        protected override XmlElement CreateArcElement(XmlDocument document)
        {
            return document.CreateElement(
                PackageVocabulary.PackageNamespacePrefix,
                PackageVocabulary.SlurElementName,
                PackageVocabulary.PackageNamespaceUri
                );
        }

        #endregion
    }
}
